<template>
	<div class="resend_email col-sm-12" :style="{height: heightData}">
		<div class="col-sm-4"></div>
		<div class="col-sm-4 signform">
			<img src="../assets/img/logo.png" alt="" class="sign_logo cursor" @click="goHome()"/>
			<h2>操作成功</h2>
			<p class="text-center">邮件已发送到您的邮箱,请验证邮件</p>
			<p class="userSee">已收到邮件，<router-link :to="{name:'home'}">返回首页</router-link></p>
			<p>没有收到验证邮件？<a href="javascript:;" @click="resendEmail(0)">再次发送</a></p>
			<p>没有收到忘记密码邮件？<a href="javascript:;" @click="resendEmail(1)">再次发送</a></p>
			<p class="log_tips" v-if="seen" style="text-align:center!important;">{{resendTip}}</p>
		</div>
	</div>
</template>

<script>
	import {urlResendEmail} from '../api/api'
	
	export default {
		name: 'resendEmail',
		data () {
		    return {
		    	path:'',
		    	seen:true,
		    	resendTip:'',
		    	heightData:''
		    }
		},
		mounted(){
	    	this.heightData=`${document.documentElement.clientHeight}px`;
	    },
		methods: {
			goHome(){
				this.$router.replace('/');
			},
			resendEmail(path){
				//0: 重发验证邮件,1: 重发重置邮件
				this.path=path;
				let sendData={
					email:this.$route.params.email,
					type:this.path
				};
				urlResendEmail(sendData).then(response => {
					if(response.data.code==200){
						this.seen=true;
						this.resendTip='发送成功';
					}else{
						this.seen=true;
						this.resendTip=response.data.message;
					}
	        	 })				
			}
		}
	}
</script>

<style>
	@import "../assets/css/sign.css"
</style>